%h1.album= "Edit \"" + @album.name + "\""
%table.album
  - form_for @album, albums_url, :method => :put do |form|
    %tr
      %td.field_title Name:
      %td.field= form.text_field     :name
      %td.error= error_message_on    :album, :name
    %tr
      %td.field_title Year:
      %td.field= form.text_field     :year
      %td.error= error_message_on    :album, :year
    %tr
      %td.field_title Purchase Link:
      %td.field= form.text_field     :purchase_link
      %td.error= error_message_on    :album, :purchase_link
    %tr
      %td.field_title Artwork:
      %td.check_box_fields
        - @artworks.each do |artwork|
          %table.artwork_thumb
            %tr
              %td.artwork_thumb
                %a{:href => artwork_url(artwork)}
                  %img.artwork_thumb{:src => artwork.public_filename(:thumb), :title => artwork.filename, :alt => artwork.filename}
            %tr
              %td.check_box= check_box_tag("album[artwork_id]", artwork.id, @album.artwork == artwork)
        or add
        %a{:href => new_artwork_url}new one
    %tr
      %td.field_title Songs:
      %td.check_box_fields
        %table.album_songs
          - @songs.each do |song|
            %tr{:style => "background-color: #{cycle("#ffffff", "#e9e9e9")}"}
              %td.check_box
                = check_box_tag("album[song_ids][]", song.id, @album.songs.include?(song))
              %td.song_name
                %a{:href => song_url(song), :title => song.name, :alt => song.name}= song.name
              - if song.downloadable?
                %td.play_song
                  %object{:height => "17", :width => "17", :data => "/assets/button/musicplayer.swf?&b_colors=80FF00,257b00,80FF00,FF0000&playlist_url=" + song_url(song) + ".xml", :type => "application/x-shockwave-flash"}
                    %param{:value => "/assets/button/musicplayer.swf?playlist_url=" + song_url(song) + ".xml", :name => "movie"}
                    %img{:height => "17", :width => "17", :alt => "play", :src => "/assets/noflash.gif"}
    %tr
      %td.submit= submit_tag 'Update'
  - form_for @album, albums_url, :html => {:method => :delete} do |form|
    %tr
      %td.delete= submit_tag 'Delete'